﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Channels;
using System.Text;

namespace SimpleServiceBus.Endpoints.DotNetServiceBus.Transport
{
    public class MessageListener : IOnewayReceiver
    {
        public event EventHandler<WcfMessageEventArgs> MessageReceived;

        public void Accept(Message message)
        {
            OnMessageReceived(message);
        }

        protected virtual void OnMessageReceived(Message message)
        {
            var evt = MessageReceived;
            if (evt != null)
                evt(this, new WcfMessageEventArgs(message));
        }
    }
}
